UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z/G40LxmQhLN5uz1UYe15iUl9WA4cGQ06x61wzNX8Ns=' 
WHERE 
  key_id = '0b7b6076893f08a1854e3575748a809027e1616ca3a3d8276098af0bd894e812' 
  AND (
    token = 'Z/G40LxmQhLN5uz1UYe15iUl9WA4cGQ06x61wzNX8Ns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054