UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p6eG+oG0UDu6rUP0CkA+DAdQujeyhLNVCtdyJK24XDc=' 
WHERE 
  key_id = '7636690ae0766a6c5677212bbd49c840a365a527ee9ff81493219a77e1126edd' 
  AND (
    token = 'p6eG+oG0UDu6rUP0CkA+DAdQujeyhLNVCtdyJK24XDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047