UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PKC3zjLxTkwjtQzy5SW8CfPgoh4EzMvtK8VZNhaLlNk=' 
WHERE 
  key_id = '16d082ce198eaa7fa36b3befaccbfb72e21387f88c295837a1995c4fa20257b3' 
  AND (
    token = 'PKC3zjLxTkwjtQzy5SW8CfPgoh4EzMvtK8VZNhaLlNk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031