UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dXbSpzvIuOqzLvaSWvyycruQU82JLwd4DWywzy66m5w=' 
WHERE 
  key_id = '43e8f09df4238d6825ba096618df9e8b5f5977559c7cef9519138b417acee306' 
  AND (
    token = 'dXbSpzvIuOqzLvaSWvyycruQU82JLwd4DWywzy66m5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038