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

Query time 0.00026