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

Query time 0.00046