UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JqYND5TgYRy1JZ6Cr8TWZRDJ38pxeRvczh4a3zQFJpA=' 
WHERE 
  key_id = '8313d3ebf2cb568206d93984363d20b06d01e5f59c72a8cd4aff44e0120d36a6' 
  AND (
    token = 'JqYND5TgYRy1JZ6Cr8TWZRDJ38pxeRvczh4a3zQFJpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050