UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ROMuPyKery4hvy1TcZgqlFezdV1vkt8m1C84yDqyCLI=' 
WHERE 
  key_id = '081e1c0a631b65d577d6585a12e29ff9970a3f589a80d3162c3bb468b47df254' 
  AND (
    token = 'ROMuPyKery4hvy1TcZgqlFezdV1vkt8m1C84yDqyCLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029