UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cQxh2i1AlJ73KVrm2WoveTX3hIVSpBv3iOks9Zz4i7c=' 
WHERE 
  key_id = '17ec0b14c31a453a29fed7900869c7b5f86423a9c7479ca57edf48c498c19ccc' 
  AND (
    token = 'cQxh2i1AlJ73KVrm2WoveTX3hIVSpBv3iOks9Zz4i7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050