UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6s9NQN7TucbYHepIfC2epGNk0/TuJfiIJl0B6fwajcw=' 
WHERE 
  key_id = '18c45b7bf5d3b4769002a607dd111ae56537700772ac437feca8676215ebae2f' 
  AND (
    token = '6s9NQN7TucbYHepIfC2epGNk0/TuJfiIJl0B6fwajcw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034