UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nlSHV5XSggtVrttMaqy8Mo+IpzpQa8/XC2zqUhMm7YI=' 
WHERE 
  key_id = '07d0b7a8787b65d7567d5b856cd6922e7c55c312418bbb2c7d3ecf67d89b8064' 
  AND (
    token = 'nlSHV5XSggtVrttMaqy8Mo+IpzpQa8/XC2zqUhMm7YI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033