UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wVkN5akERUNyHykZqQkl0zyD592eFaIjB0NNq15z+wg=' 
WHERE 
  key_id = 'df880ee3889844111bee1f703a8fed0463723e5914931d8c79e3f7cf1bca3e63' 
  AND (
    token = 'wVkN5akERUNyHykZqQkl0zyD592eFaIjB0NNq15z+wg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028