UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sGApqc+a7KjMgvIUyHomqwDuMzSGbecp4TqeXMlSJJo=' 
WHERE 
  key_id = '58960adb04638325f120c85db47e33f9725dca4639388b9edcc9e729a540e65f' 
  AND (
    token = 'sGApqc+a7KjMgvIUyHomqwDuMzSGbecp4TqeXMlSJJo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044