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

Query time 0.00025