UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BnYbDNi+puTMedAh7qmUuebOAXV4GbMUneZ36lrxJwY=' 
WHERE 
  key_id = '54778b63f5b8baaf9ad52dbc4afec31bd47d39b4a0eeb5b9efb8b8a52fa6402c' 
  AND (
    token = 'BnYbDNi+puTMedAh7qmUuebOAXV4GbMUneZ36lrxJwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040