UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iWSDcl6pU2adA2+KAyHvNzjYnhCy6UjcqHGvN4EK7zA=' 
WHERE 
  key_id = '7c181749cbc9e8c16bfd321cfd5f032c3e08b5b5968cfbef8c3ec5c378c7ca49' 
  AND (
    token = 'iWSDcl6pU2adA2+KAyHvNzjYnhCy6UjcqHGvN4EK7zA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043