UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uadoDT0wwNxrdoNVU5CpWV/QRqMUUNzHIqpOKdOZZ/o=' 
WHERE 
  key_id = 'f2f25ec139e51b3060a688a19e45c8f92f51b4a5a0ccc0ee531460a4e3b84e71' 
  AND (
    token = 'uadoDT0wwNxrdoNVU5CpWV/QRqMUUNzHIqpOKdOZZ/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046