UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bt4SY+tTOfwy/AgrzvI6ElwCXm5ea6OCoRAb+Azg9/I=' 
WHERE 
  key_id = '23dcc7d7b525b7c835faad78fe26af9d01efd3494c99e1939b9ac15d53f1580a' 
  AND (
    token = 'bt4SY+tTOfwy/AgrzvI6ElwCXm5ea6OCoRAb+Azg9/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023