UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+Gt3ZPi2Z3rwDt7QPkr8BfTrttXluxyhGRVbX+OipUE=' 
WHERE 
  key_id = 'cfe439c3edb03efee1381a033adbe5d7d39714595f5d11786d18d98d23c7d27f' 
  AND (
    token = '+Gt3ZPi2Z3rwDt7QPkr8BfTrttXluxyhGRVbX+OipUE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022