UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fOi/JKO84AKkXsozNZa0TZriX/OSkmNGRcjULS9iBaY=' 
WHERE 
  key_id = '6b488d11d1208b1ad58a633f5687c04d317dbcf3a9e6ec3dc73cd0d1f418793d' 
  AND (
    token = 'fOi/JKO84AKkXsozNZa0TZriX/OSkmNGRcjULS9iBaY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038