UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gZbpRMp6L7ZmEKN8sJSn2445CBAbez+FurzY7VJ0DfI=' 
WHERE 
  key_id = '05cacc97ecea090dc8cf672a3a49e988189c8708ecb41190b7317f1b5d891845' 
  AND (
    token = 'gZbpRMp6L7ZmEKN8sJSn2445CBAbez+FurzY7VJ0DfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023