UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qqDqQ3DIShwR0Ub2ohQldCzRLRCKJ3oXVI6DSafhNEU=' 
WHERE 
  key_id = '01c12fb2382aa973d97b9bc621a28727ca983aa2b92ad2234c3fc6a0aa090d64' 
  AND (
    token = 'qqDqQ3DIShwR0Ub2ohQldCzRLRCKJ3oXVI6DSafhNEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023