UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IAPE9hfJL4vjWl+L9LAEDsTAFQ0Wp/bm6rPxsqTrLZM=' 
WHERE 
  key_id = '85c1ee4c280463ffd0c4311759904f08262cd23117a83f3ff1b88066175acc9d' 
  AND (
    token = 'IAPE9hfJL4vjWl+L9LAEDsTAFQ0Wp/bm6rPxsqTrLZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046