UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f0Z5tEOdQ0mo9ZY3LKhPWGdTd/h2pUWPBfDvVadhFoI=' 
WHERE 
  key_id = '3efbef112957b83d2d7a97176359ad42287fb2e3ac823f68c0263a8c8f695b15' 
  AND (
    token = 'f0Z5tEOdQ0mo9ZY3LKhPWGdTd/h2pUWPBfDvVadhFoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025