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

Query time 0.00031