UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hpRc36R8sb6UqD+IzR22dirnowxR6gKFCWRit8n7T/s=' 
WHERE 
  key_id = '1bac90bbc00fff2e6a8f06e7dd707003fc0cc4e3dde26fedbca4fa274121116a' 
  AND (
    token = 'hpRc36R8sb6UqD+IzR22dirnowxR6gKFCWRit8n7T/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029