UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VZGQiOaEdbAZtx1IHid2uZYrFMikOXBJfUW8+juftO8=' 
WHERE 
  key_id = '3675ec259017b6c5b589060cc04598ba6d6fba0213cd44063ae3ef87eeab78f5' 
  AND (
    token = 'VZGQiOaEdbAZtx1IHid2uZYrFMikOXBJfUW8+juftO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045