UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vbnGklSFBhsUtaxljrtJRMFYTX1ZyIG58isMRfwjyEs=' 
WHERE 
  key_id = '74b125ed2214975004a87d943ad559472c1f54ad9238765b8edc98713ee97a94' 
  AND (
    token = 'vbnGklSFBhsUtaxljrtJRMFYTX1ZyIG58isMRfwjyEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037