UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tWYMYIzel2X3Zxotl9nbb9LKQ+qJgqzXUd+9tj9W8FQ=' 
WHERE 
  key_id = '1d567ab89b19dab889a314fb7f7f8ad932f2c7e58b272e2afbfbe0088bf1be92' 
  AND (
    token = 'tWYMYIzel2X3Zxotl9nbb9LKQ+qJgqzXUd+9tj9W8FQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030