UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X5IIzGvOiX8kP8+XiKDCiEbz6lhfHyIBbGKUsqs9kZI=' 
WHERE 
  key_id = '364a016f5a5bcbe81b3893a4d5e087b80b4e4044df4517f0e69db24089116eb7' 
  AND (
    token = 'X5IIzGvOiX8kP8+XiKDCiEbz6lhfHyIBbGKUsqs9kZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031