UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wyC55TswvVX0+exTWq4Y/W2QtlJuVrIuZ184gBYnr98=' 
WHERE 
  key_id = '6aea0980665922e2842e97fca850a0f1b7c1448551eac11ea5407e5504f50994' 
  AND (
    token = 'wyC55TswvVX0+exTWq4Y/W2QtlJuVrIuZ184gBYnr98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029