UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lheo4KUfz4wdAeJOvs962QaaseutIrxiEWRUTvEWfzc=' 
WHERE 
  key_id = 'c5753ac816ddf5a438d2052bbfbbb78c436c944a1c68d4394bd85275a380f5b6' 
  AND (
    token = 'lheo4KUfz4wdAeJOvs962QaaseutIrxiEWRUTvEWfzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037