UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xoy0vgA0U3Lrdcv2SQceiUsgacPz2F2El729iywlTUU=' 
WHERE 
  key_id = '6b6e4b8c331bec69af1e4f164c722c3abe74247f66083e15890db55a0a8cfc3a' 
  AND (
    token = 'xoy0vgA0U3Lrdcv2SQceiUsgacPz2F2El729iywlTUU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038